<?php
use app\admin\model\AuthRule;
?>
{layout name="layout/layout" /}
<div class="king-content-wrap">
    <div class="king-layout1-content" style="margin-top: 0;margin-left: 0;">
		<ol class="breadcrumb">
		  	<li><span>栏目管理</span></li>
		  	<li><span>栏目列表</span></li>
		</ol>
		<div class="clearfix m20">
	        <a class="btn btn-success" href="{:Url('Right/addRule')}">添 加</a>
		</div>
		<div class="panel panel-default m20">
		    <div class="panel-body">
                {empty name="items"}
                无记录
                {else /}
				{volist name="items" id="item"}
				<ul class="list-group">
					<li class="list-group-item">
						<span>{$item.title}</span>
                        <span>{$item.name}</span>
						<span style="float:right;">
							<a href="{:Url('Right/addRule?parent_id='.$item->id)}">添加下级权限</a>
							<a href="{:Url('Right/editRule?id='.$item->id)}">编辑</a>
							<a class="del" data-id="{$item.id}" data-url="{:Url('Right/delRule')}" href="javascript:void(0);">删除</a>
                        </span>
                        <?php $children = AuthRule::where(['parent_id' => $item->id])->select();?>
                        {notempty name="$children"}
        				<ul>
        					{foreach name="children" item="child"}
        					<li class="list-group-item">
        						<span>{$child.title}</span>
                                <span>{$child.name}</span>
        						<span style="float:right;">
        							<a href="{:Url('Right/editRule?id='.$child->id)}">编辑</a>
        							<a class="del" data-id="{$child.id}" data-url="{:Url('Right/delRule')}" href="javascript:void(0);">删除</a>
        						</span>
                            </li>
        					{/foreach}
        				</ul>
                        {/notempty}
					</li>
				</ul>
				{/volist}
                {/empty}
			</div>
		</div>

	</div>
</div>
